package com.fengycx.app;

import com.fengycx.result.R;
import com.fengycx.service.IPayOrderService;
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("app/payOrder")
public class AppPayOrderController {

    @Autowired
    private IPayOrderService payOrderService;


    /**
     * 用户通过个推回调拿到订单号进行预支付
     * @param orderNo
     * @return
     */
    @PostMapping("/wechat/{orderNo}")
    public R<PrepayWithRequestPaymentResponse> payOrderWechatPrepay(@PathVariable("orderNo") String orderNo){
        return R.success( payOrderService.payOrderWechatPrepay(orderNo));
    }

}
